package com.demo.study.behavior.inbound;

import com.demo.study.behavior.inbound.dto.InboundApplication;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import static com.demo.study.behavior.inbound.dto.InboundApplication.DOA_DAP_RETURN;
import static com.demo.study.behavior.inbound.dto.InboundApplication.OTHER;
import static com.demo.study.behavior.inbound.dto.InboundApplication.PROTOTYPE_RETURN_TYPE;

/**
 * @author Baymax
 * @since 2022/3/25
 */
public class Client {
    private static final String YES = "Y";
    private static final String NO = "N";

    public static void main(String[] args) {
        List<InboundApplication> applications = buildInboundApplications();
        InboundInvoker inboundInvoker = new InboundInvoker(applications);
        inboundInvoker.invoke();
    }

    private static List<InboundApplication> buildInboundApplications() {
        List<InboundApplication> inboundApplications = new ArrayList<>();
        inboundApplications.add( // 退换货返还的数据
            InboundApplication.builder()
                .applicationNo("TEST03250001")
                .returnType(DOA_DAP_RETURN)
                .businessId(getBusinessId())
                .fcrmFlag(NO)
                .build());

        inboundApplications.add( // 样机返还的数据
            InboundApplication.builder()
                .applicationNo("TEST03250002")
                .returnType(PROTOTYPE_RETURN_TYPE)
                .businessId(getBusinessId())
                .fcrmFlag(NO)
                .build());

        inboundApplications.add( // 正常数据
            InboundApplication.builder()
                .applicationNo("TEST03250003")
                .returnType(OTHER)
                .businessId(getBusinessId())
                .fcrmFlag(NO)
                .build());

        inboundApplications.add( // 正常数据
            InboundApplication.builder()
                .applicationNo("TEST03250004")
                .returnType(OTHER)
                .businessId(getBusinessId())
                .fcrmFlag(YES)
                .build());

        inboundApplications.add( // 研发拦截数据
            InboundApplication.builder()
                .applicationNo("TEST03250005")
                .returnType(OTHER)
                .businessId(getBusinessId())
                .fcrmFlag(YES)
                .frozenFlag(YES)
                .build());
        return inboundApplications;
    }

    private static String getBusinessId() {
        return UUID.randomUUID().toString().replace("-", "");
    }
}
